package cn.tedu.spring.dimap;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 测试类
 */
public class MapTest {
    /** 测试list集合属性注入*/
    @Test
    public void setList(){
        ApplicationContext context= new ClassPathXmlApplicationContext("bean-dilistmap.xml");
        Teacher teacher=context.getBean("teacher",Teacher.class);
        System.out.println(teacher);
    }
    /**
     * 测试map集合属性注入
     */
    @Test
    public void setMap(){
        ApplicationContext context= new ClassPathXmlApplicationContext("bean-dimap.xml");
        Student student=context.getBean("student",Student.class);
        System.out.println(student);

    }
    /**
     * 测试引用集合属性注入的bean
     */
    @Test
    public void Map(){
        ApplicationContext context= new ClassPathXmlApplicationContext("bean-diref.xml");
        Student student=context.getBean("student",Student.class);
        System.out.println(student);

    }
    /**
     * 测试p命名空间
     */
    @Test
    public void p(){
        ApplicationContext context= new ClassPathXmlApplicationContext("bean-diref.xml");
        Student student=context.getBean("student2",Student.class);
        System.out.println(student);

    }
}
